package cn.xuan.scan.common.utils;

import java.util.Iterator;
import java.util.List;

import org.dom4j.Document;
import org.dom4j.Element;
import org.dom4j.Node;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class XMLUtils {
	private static final Logger logger = LoggerFactory.getLogger(XMLUtils.class);
	public static void main(String[] args) {
		XMLFileReader xmlFileReader = new XMLFileReader("ifc/orderExportConfig.xml");
		List nodesList1 = xmlFileReader.getSelectElements("/root/productType1/node");
		logger.debug("解析节点信息");
		for (Object object : nodesList1) {
			Node node = (Node) object;
			logger.info("{}==={}==={}==={}",node.valueOf("@type"),node.valueOf("@enName"),node.valueOf("@cnName"),node.valueOf("@sql"));
		}
		/*Document document = xmlFileReader.getDocument();
		Element rootElement = document.getRootElement();
		
		;
		logger.info("{}===",rootElement.getName());
		

		
		 for (Iterator i = rootElement.elementIterator(); i.hasNext();) {  
		        Element el = (Element) i.next();  
//		        logger.info(el.getName());
		        logger.info("{}==={}",rootElement.getName(),rootElement.attributeValue("name"));
		    }  */
		/*List nodesLi12st1 = xmlFileReader.getSelectElements("/root/productType1/node");
		
		for (Object object : nodesList1) {
			Node node = (Node) object;
			System.out.println(node.getName());
		}*/
		
	}

}
